'check prime'
def isPrime (num)
  if num<2
    return FALSE
  end
  if num==2
    return TRUE
  end
  stemp = Math .sqrt (num)

  for x in 2..stemp do
      if num%x==0 then
        return FALSE
      end
  end
  return TRUE
end

'printf prime power'
def printPrimePower (num)
  $result  = Array.new()
  for x in 2..num do
    if isPrime (x) then
      $result.push(x)
      y=2
      while x**y<num do
        $result.push (x**y)
        y=y+1
      end
    end
  end
  $result.sort! {|x,y| y <=> x }
  $result .each do |x|
    print "#{x} "
  end
end

print "Nhap vao so nguyen n\n"
primepower = gets.to_i
printPrimePower (primepower)